package com.ruoyi.environment.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.environment.mapper.OpmEnvFacilityRecordMapper;
import com.ruoyi.environment.domain.OpmEnvFacilityRecord;
import com.ruoyi.environment.service.IOpmEnvFacilityRecordService;

/**
 * 环保维护Service业务层处理
 *
 * @author cjie
 * @date 2021-07-23
 */
@Service
public class OpmEnvFacilityRecordServiceImpl implements IOpmEnvFacilityRecordService {
    @Autowired
    private OpmEnvFacilityRecordMapper opmEnvFacilityRecordMapper;

    /**
     * 查询环保维护
     *
     * @param id 环保维护ID
     * @return 环保维护
     */
    @Override
    public OpmEnvFacilityRecord selectOpmEnvFacilityRecordById(Long id) {
        return opmEnvFacilityRecordMapper.selectOpmEnvFacilityRecordById(id);
    }

    /**
     * 查询环保维护列表
     *
     * @param opmEnvFacilityRecord 环保维护
     * @return 环保维护
     */
    @Override
    public List<OpmEnvFacilityRecord> selectOpmEnvFacilityRecordList(OpmEnvFacilityRecord opmEnvFacilityRecord) {
        return opmEnvFacilityRecordMapper.selectOpmEnvFacilityRecordList(opmEnvFacilityRecord);
    }

    /**
     * 新增环保维护
     *
     * @param opmEnvFacilityRecord 环保维护
     * @return 结果
     */
    @Override
    public int insertOpmEnvFacilityRecord(OpmEnvFacilityRecord opmEnvFacilityRecord) {
        opmEnvFacilityRecord.setId(IdUtil.getSnowflake(0, 0).nextId());
        opmEnvFacilityRecord.setCreateTime(DateUtils.getNowDate());
        opmEnvFacilityRecord.setCreateBy(SecurityUtils.getUsername());
        return opmEnvFacilityRecordMapper.insertOpmEnvFacilityRecord(opmEnvFacilityRecord);
    }

    /**
     * 修改环保维护
     *
     * @param opmEnvFacilityRecord 环保维护
     * @return 结果
     */
    @Override
    public int updateOpmEnvFacilityRecord(OpmEnvFacilityRecord opmEnvFacilityRecord) {
        opmEnvFacilityRecord.setUpdateTime(DateUtils.getNowDate());
        opmEnvFacilityRecord.setUpdateBy(SecurityUtils.getUsername());
        return opmEnvFacilityRecordMapper.updateOpmEnvFacilityRecord(opmEnvFacilityRecord);
    }

    /**
     * 批量删除环保维护
     *
     * @param ids 需要删除的环保维护ID
     * @return 结果
     */
    @Override
    public int deleteOpmEnvFacilityRecordByIds(Long[] ids) {
        return opmEnvFacilityRecordMapper.deleteOpmEnvFacilityRecordByIds(ids);
    }

    /**
     * 删除环保维护信息
     *
     * @param id 环保维护ID
     * @return 结果
     */
    @Override
    public int deleteOpmEnvFacilityRecordById(Long id) {
        return opmEnvFacilityRecordMapper.deleteOpmEnvFacilityRecordById(id);
    }
}
